const app = getApp();
Page({
  data: {
    sortIndex:'0',
    sort:[],
    searchKey: '',
  },
  onLoad: function () {
    let that = this;
    wx.showLoading({
      title: '加载中...',
    })
    app.request('product/goodsCategory',{},'GET',false,function(res){
      let sortIndexArr=[];
      for (let k in res.data.data){
        sortIndexArr.push(k)
      }
      that.setData({
        pageShow: true,
        sort: res.data.data,
        sortIndex: sortIndexArr[0],
      })
    })
  },
  getFormid(e) {
    app.getFormid(e);
  },
  skipPage: function (e) {
    app.skipPage(e);
  },
  searchInput(e){
    this.setData({
      searchKey: e.detail.value,
    })
  },
  search(e) {
    let that = this;
    wx.navigateTo({
      url: '/pages/list/list?value=' + that.data.searchKey,
    })
  },
  sortChoose:function(e){
    let that = this;
    let index = e.currentTarget.dataset.index;
    that.setData({
      sortIndex: index,      
    })
    // wx.pageScrollTo({
    //   selector: '#list'+index
    // })
  },
  onReachBottom: function () {

  },
  onShareAppMessage: function () {

  }
})